////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2011-2012 www.iflytek.com. All Rights Reserved.
//  This software for customer relationship management system, developed by Noo team.
//  Software code and design for the team, copy rights reserved.
////////////////////////////////////////////////////////////////////////////////

package com.iflytek.ci.cums.dao;

import java.util.List;

import com.iflytek.ci.cums.domain.Role;
import com.iflytek.ci.main.dto.MyBatisQuery;
import com.iflytek.framework.mybatis.extra.MyBatisDao;
import com.iflytek.framework.pagination.PaginationCriteria;
import com.iflytek.framework.pagination.PaginationResult;
import org.apache.ibatis.annotations.Param;

/**
 * <p>
 * role database dao.
 * </p>
 *
 * @author poplar.yfyang
 * @version 1.0 2012-11-16 2:29 PM
 * @since JDK 1.5
 */
@MyBatisDao
public interface RoleDao {
	/**
	 * pagination role's information
	 *
	 * @param criteria pagination
	 * @return role result
	 */
	PaginationResult<Role> find_page_roles(PaginationCriteria criteria);

	/**
	 * According to the key ID gets the role information.
	 *
	 * @param role_id role key id.
	 * @return role information
	 */
	Role find_id(@Param(MyBatisQuery.ID_QUERY_PARAM) long role_id);

	/**
	 * According to the user ID gets the use role information.
	 *
	 * @param user_id user's id
	 * @return user role information.
	 */
	List<Role> user_role(long user_id);

	/**
	 * add new role.
	 *
	 * @param role role
	 * @return The successful implementation of a number of database.
	 */
	int add(Role role);

	/**
	 * remove role information.
	 *
	 * @param id role's id
	 * @return the successful implementation of a number of database.
	 */
	int remove_id(long id);
}
